export const getObjectInStorage=(key,def)=>{
  return localStorage.getItem(key)?JSON.parse(localStorage.getItem(key)):def
}

export const getStringInStorage=(key,def)=>{
  localStorage.getItem(key)?localStorage.getItem(key):def
}
export const setItemInStorage=(key,val)=>{
  localStorage.setItem(key,val)
}
export const removeItemInStorage=(key)=>{
  localStorage.removeItem(key)
}
export const isUserInfoExpired=()=>{
  let user = getObjectInStorage('user',{expiredTime:0})
  let nowTime = new Date()/1000
  return user.expiredTime < nowTime;
}
